initial SOF hdac serials. - #47
Conversation
There was a problem hiding this comment.
this looks odd. why is this needed in the boards Kconfig?
Looks further, this makes no sense, in the same patch you have
select SND_SOC_SOF_HDA if SND_SOC_SOF_HDA_COMMON
+config SND_SOC_SOF_HDA
- tristate
- depends on SND_SOC_SOF_HDA_COMMON
so you've expressed a dependency twice for no good reason
There was a problem hiding this comment.
um, this do need rewrite, I will do that. But before that, can you explain to me that is selecting 2 machine driver(e.g. BXT_TDF8532_MACH and SKL_HDA_DSP_GENERIC_MACH) together is our intention?
plbossart
left a comment
There was a problem hiding this comment.
This is a big series and we should probably try to think about the code structure to make it less invasive. See comments below
There was a problem hiding this comment.
do we really want hda_bus at the snd_sof_dev level? This is a bit Intel-centric, maybe it should be hidden in HDA specific structures, no?
There was a problem hiding this comment.
today I will work on this, Liam suggest me to unify it with sof_intel_hda_dev(delete sof_intel_hda_dev if possible), Mengdong give a good suggestion that using private struct for it then other arch(e.g. ARM, non-HDA stuff) can reuse it.
There was a problem hiding this comment.
I thought we needed different ring buffers for CORB and RIRB, similar to capture and playback?
There was a problem hiding this comment.
they are allocated together(4KB) and corb/rirb are initialized to use different regions( pls refer to snd_hdac_bus_init_cmd_io()):
bus->corb.addr = bus->rb.addr;
bus->rirb.addr = bus->rb.addr + 2048;
There was a problem hiding this comment.
You probably want to rename this Kconfig to CONFIG_SND_SOC_SOC_HDA_LINK ?
HDA can mean controller, bus or codec. Here you handle the two latter topics.
There was a problem hiding this comment.
good suggestion, will change it.
There was a problem hiding this comment.
avoid copy/pastes from GPL comments
There was a problem hiding this comment.
will remove/rewrite them, thanks.
There was a problem hiding this comment.
that looks wrong. We get the PCM period updates from the existing SOF code, why do we need to do this based on link information?
There was a problem hiding this comment.
could we have an .ops here and select which mode we want? It'd allow all the HDA link part to go in a different file. Ifdefs are hard to handle at some point, it's difficult to read.
There was a problem hiding this comment.
the defines are probably wrong, if IS_ENABLED(CONFIG_SND_SOC_HDAC_HDA) is false, the ext_ops is not initialized. Is this is intentional you've got to comment it.
There was a problem hiding this comment.
um, this comes from cAVS, no chance to debug it yet, if soc_hdac_hda unselected, I think it may pass ext_ops with NULL and no ops(e.g. attach/detach) will be processed?
There was a problem hiding this comment.
the part below is super hard to review.
There was a problem hiding this comment.
um, Liam helps to refine and consolidate them in his consequent commit.
There was a problem hiding this comment.
Differentiation was moved to separate new functions to avoid lots of conditional compilation logic in a single function.
There was a problem hiding this comment.
I suggest we don't make the same mistake as cAVS. the entire code for HDMI is common between platforms, so let's do it right from day 1, by adding the links from a common code instead of copy/pasting.
There was a problem hiding this comment.
yes, we have problem here. So our intention is to add skl_hda_be_dai_links[] from skl_hda_dsp_common.c together with broxton_tdf8532_dais[] at broxton_tdf8532_audio_probe()?
|
updates on 0723:
|
|
@lgirdwood @mengdonglin @plbossart please be noticed that it is updated. |
|
@lgirdwood @mengdonglin @plbossart |
|
update on 0725: |
|
|
||
| #include <sound/hdaudio.h> | ||
|
|
||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) |
There was a problem hiding this comment.
Isn't this implied by Kconfig option
There was a problem hiding this comment.
are you meaning that IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) is true always?
the answer is no for that, it is tristate, we can choose them or not in menuconfig.
|
|
||
| #endif | ||
|
|
||
| static void sof_hda_reg_writel(u32 value, u32 __iomem *addr) |
There was a problem hiding this comment.
Any need to wrap these ? cant the ops point to writew() etc directly ?
There was a problem hiding this comment.
just went through them again, no need to wrap them, let me change them, thanks.
There was a problem hiding this comment.
sorry, double checked this, we can't point to writew() etc directly, as they are actually inline functions and will be expanded(not functions then), so we still need to wrap them.
| @@ -1,9 +1,9 @@ | |||
| // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) | |||
| #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA) | ||
|
|
||
| #if 0 | ||
| static int sof_hda_acquire_irq(struct hda_bus *hbus, int do_disconnect) |
There was a problem hiding this comment.
MSI doesn't work for HDA in my testing, so I set it to legacy mode temporary, will change it to MSI once it is verified works.
| int irq; | ||
| }; | ||
|
|
||
| #define SOF_STREAM_SD_OFFSET(s) (0x20 * ((s)->index) + SOF_HDA_ADSP_LOADER_BASE) |
There was a problem hiding this comment.
we should change it to an macro, it is size of all registers belong to a separated stream.
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Do we need period_elapsed() ?
There was a problem hiding this comment.
IMO, no, we do that in IPC interrupt handler.
| ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, 8, | ||
| &hdev->posbuffer); | ||
| /* TODO: check postion buffer update */ | ||
| ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev, 8 * num_total, |
There was a problem hiding this comment.
8 Bytes is the size of DMA posistion for each stream defined in HDA spec, let me change it to macro also.
| * support msi multiple vectors | ||
| */ | ||
| // ret = pci_alloc_irq_vectors(pci, 1, 1, PCI_IRQ_MSI); | ||
| /* todo: MSI mode doesn't work for HDMI yet, debug it later */ |
There was a problem hiding this comment.
Is this still true ? If so, temp workaround is to use LEGACY IRQ for HDAC mode (based on Kconfig) otherwise MSI.
There was a problem hiding this comment.
Differentiation was moved to separate new functions to avoid lots of conditional compilation logic in a single function.
|
|
||
| config SND_SOC_SOF_HDA | ||
| tristate | ||
| tristate "SOF support for HDA Links(HDA/HDMI)" |
There was a problem hiding this comment.
Does this have a help section (check patch complains without one).
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We need register/enable irq handler before init_caps, where we are doing codec probing for HDMI/HDA, otherwise the probing may fail. We also need to use PCI_IRQ_LEGACY mode at the moment, as PCI_IRQ_MSI doesn't work for HDMI yet, may need more debug to fix it. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
f22e0d3 to
410c8ea
Compare
This patch doesn't replace struct sof_intel_hda_dev with hda_bus, but embed hda_bus in sof_intel_hda_dev. It's becasue there are a few memebers of sof_intel_hda_dev are not in hda_bus. Host streams are managed by hdac_bus's stream_list now. Compiling okay. But not test yet. May have conflict with Keyon's PR today. I'll rebase and merge it to Keyon's PR later. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
In previous patch, hdac_bus is used to manage the host streams, but the stream structure is still struct sof_intel_hda_stream. This patch replaces struct sof_intel_hda_stream with hdac_ext_stream, but the stream management is still using BSD implementation of SOF, not the GPL implemenation of HDA core. Please note that - hdac_bus maintains a stream list of hdac_stream, which is embeded in struct hdac_ext_stream. - pcm runtime's private data points to hdac_stream, not hdac_ext_stream. Compiling okay. Not tested yet. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
…issue. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
1. add hda-bus to handle hda bus initialization, for both with/without HDA links support. 2. split hda-codec out from hda-common, and compile it when SOF_HDA is selected. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We uses CONFIG_SND_SOC_SOF_HDA to enable HDA links on SOF, here refine SOF HDA code to split them and make both select/unselect the config CONFIG_SND_SOC_SOF_HDA works. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
|
all are addressed. @lgirdwood |
No description provided.